# controller

# responsible for the build of the main-page-screen, when octopus is started
# put the different information (html-pieces) together


from google.appengine.ext import webapp
from google.appengine.ext.webapp import template

#from google.appengine._internal.django.utils.translation import ugettext as _

#from google.appengine._internal.django.utils.translation import ugettext_lazy as _

from Utilities import *

class BuildMainPage(webapp.RequestHandler):
    # pSelf is the self-attribute from the calling instance. use the self-attribute from this class woudn't work, because it's the work one
    def get(self, pSelf, templateValues):
        utilities = Utilities()
        
        # basic data
        title = utilities.getTitleText()
        userText = templateValues['userText']
        username = templateValues['user']
        url = templateValues['url']
        urlText = templateValues['urlText']
        hintText = templateValues['hintText']
        hintColor = templateValues['hintColor']

        # menu-text
        credentialsText = utilities.getMenuTextCredentials()
        yourDataText = utilities.getMenuTextYourData()
        infoText = utilities.getMenuTextInfo()
          
        # text for the main-page
        content = self.getContent()
        
        finalTemplateValues = {
                        'title': title,
                        'userText': userText, 
                        'user': username, 
                        'url': url, 
                        'urlText': urlText,
                        'hintText': hintText, 
                        'hintColor': hintColor,
                        'credentials': credentialsText,
                        'yourData': yourDataText,
                        'info': infoText,
                        'content': content
                        }
        
        html = template.render('view/templates/base.html', finalTemplateValues)
        
        pSelf.response.out.write(html)


    # responsible for the content-text on the main-page
    def getContent(self):
        # text for the main-page
#        content = _('<h1>Welcome to OctopusCloud Storage Service</h1>')
#        content = content + _('Octopus is a software service, designed to help you working with cloud storage services that are compatible with the Amazon S3 service.')
#        content = content + '<p></p>'
#        content = content + _('The source code and documentation is available at the <a href="http://code.google.com/p/octopuscloud/">Octopus project site.</a>')
#        content = content + '<p></p>'
#        content = content + _('Octopus is not a marketplace for cloud storage resources.')
        content = '<h1>Welcome to OctopusCloud Storage Service</h1>'
        content = content + 'Octopus is a software service, designed to help you working with cloud storage services that are compatible with the Amazon S3 service.'
        content = content + '<p></p>'
        content = content + 'The source code and documentation is available at the <a href="http://code.google.com/p/octopuscloud/">Octopus project site.</a>'
        content = content + '<p></p>'
        content = content + 'Octopus is not a marketplace for cloud storage resources.'
        return content
    
